package artid.com.arttogo.activity;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.volley.VolleyError;

import artid.com.arttogo.R;
import artid.com.arttogo.adapter.LotIntroHisListAdapter;
import artid.com.arttogo.bean.LotMsg;
import artid.com.arttogo.db.Cache;
import artid.com.arttogo.network.VolleyBasic;
import artid.com.arttogo.network.VolleyCallback;
import artid.com.arttogo.network.VolleyData;
import artid.com.arttogo.network.VolleyMap;
import artid.com.arttogo.view.MyListView;

/**
 * 
 *    
 * 项目名称：ArtworkArt   
 * 类名称：AuctionArtist_Activity   
 * 类描述：艺术家列表   
 * 创建人：耿卫斌   
 * 创建时间：2017-3-3 下午4:32:30   
 *
 */
public class LotIntroActivity extends BaseActivity{

	TextView mTextArtistCate;
	TextView mTextSize;
	TextView mTextSeal;
	TextView mTextLogo;
	TextView mTextInfo;
	MyListView mList;
	LotIntroHisListAdapter mAdapter;
	
	String id;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_lot_intro);
		initView();
	}

	private void initView(){
		mContext=LotIntroActivity.this;
		mTittle = (TextView)findViewById(R.id.tittle_text);
		mTittle.setText("拍品介绍");
		mBack = (ImageView)findViewById(R.id.back_btn);
		mBack.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		mTextArtistCate = (TextView)findViewById(R.id.lot_intro_artist_year_cate);
		mTextSize = (TextView)findViewById(R.id.lot_intro_size);
		mTextSeal = (TextView)findViewById(R.id.lot_intro_seal);
		mTextLogo = (TextView)findViewById(R.id.lot_intro_logo);
		mTextInfo = (TextView)findViewById(R.id.lot_intro_info);
		mList = (MyListView)findViewById(R.id.lot_intro_list);
		id = getIntent().getExtras().getString("id");
		getData();
	}

	/**
	 * 获取艺术家列表
	 */
	private void getData(){
		VolleyBasic.getInstance(this).post(Cache.lotMsg,
				VolleyMap.getInstance().lotInfo(id),
				LotMsg.class, new VolleyCallback() {
			@Override
			public void onSuccess(VolleyData vd) {
				// TODO Auto-generated method stub
				LotMsg item = (LotMsg)vd.getData();
				mTextArtistCate.setText(item.getLot_author()+"/"+item.getLot_age()+"/"+
				item.getLot_class());
				mTextSize.setText(item.getLot_size()+"/"+item.getLot_mounting());
				mTextSeal.setText(item.getLot_recording());
				mTextLogo.setText(item.getLot_material());
				mTextInfo.setText(item.getLot_memo());
				
				mAdapter = new LotIntroHisListAdapter(mContext, item.getListInfo());
				mList.setAdapter(mAdapter);
				
			}

			@Override
			public void onError(VolleyError volleyError) {
				// TODO Auto-generated method stub
				
			}
		});
	}
}
